<template>
  <z-modal
    :width="800"
    title="预览表单"
    v-bind="modalOption"
    @cancel="handleCancel"
    :okButtonProps="{ class: { '!hidden': true }}"
  >
    <a-spin :spinning="confirmLoading">
      <KFormBuild class="k-form-design" ref="kfd" :dynamicData="dynamicDataSatrt" :value="formModel" />
    </a-spin>
  </z-modal>
</template>

<script>
import ModalMixins from '@/mixins/ModalMixins'
import { KFormBuild } from '@/components/k-form-design/packages/use.js'

export default {
  name: 'FormPreviewModal',
  components: { KFormBuild },
  mixins: [ModalMixins],
  data() {
    return {
      url: {
        save: '/camunda/form/edit'
      },
      dynamicDataSatrt: {},
      formModel: { } // 表单设计model
    }
  },
  methods: {
    show(row) {
      this.formModel = row.model && JSON.parse(row.model)
      this.visible = true
    },
    setDesignData(data) {
      data && this.$refs.kfd.handleSetData(JSON.parse(data))
    }
  }
}
</script>
<style lang="less">
.k-form-design{
  svg {
    display: inline;
  }
}
</style>
